# -*- coding: utf-8 -*-

from passlib.context import CryptContext

# 密码
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")

def password_hash(password: str):
    '''
    密码加密
    '''
    return pwd_context.hash(password)

def virify_password(plain_password, hashed_password):
    '''
    验证密码
    plain_password: 明文密码
    hashed_password: 加密后的密码
    '''
    return pwd_context.verify(plain_password, hashed_password)
